<template>
  <div id="article-types">
    <el-row :gutter="12">
      <el-col class="m-b-10" :span="5" v-for="(o, index) in types" :key="index" >
        <el-card shadow="hover" :body-style="{ padding: '0px'}">
          <div @click="goArticleType(o._id)" class="cursor-pointer">
            <img :src="o.articleTypeIcon" class="W100">
            <div style="padding: 14px;">
              <div >{{o.articleTypeName}}</div>
              <div class="fz-12 h-32 text-ellipsis">简介: {{o.articleTypeDescription}}</div>
              <div class="bottom clearfix">
                <time class="time">{{ o.updateTime | date}}</time>
              </div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      types: []
    }
  },
  created() {
    this.articleTypeList()
  },
  methods: {
    async articleTypeList() {
      let res = await this.api.get('/client/getArticleTypeList')
      if(res.code == 0) this.types = res.data 
    },
    goArticleType(id) {
      this.$router.push({path: `/articleType/${id}`})
    }
  },
}
</script>

<style lang="scss">
#article-types {
  width: 1100px;
  margin: 0 auto;
  padding-top: 80px;
  .button {
    padding: 0;
    float: right;
  }
}
</style>